<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title>DENSO | 作业要领书</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport"
        content="width=device-width, initial-scale=1">
  <meta name="format-detection" content="telephone=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp"/>
  <link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
  <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
  <style>
    .get {
      background: #1E5B94;
      color: #fff;
      text-align: center;
      padding: 120px 0;
    }

    .get-title {
      font-size: 200%;
      border: 2px solid #fff;
      padding: 20px;
      display: inline-block;
    }

    .get-btn {
      background: #fff;
    }

    .detail {
      margin-top: 30px;
      background: #fff;
    }

  </style>
</head>
<body>

<header class="am-topbar am-topbar-fixed-top">
  <div class="am-collapse am-topbar-collapse" id="collapse-head">
    <div class="am-topbar-right">
      <button class="am-btn am-btn-default am-topbar-btn am-btn-sm" >当前用户: #(session.operator)</button>
      <button class="am-btn am-btn-danger am-topbar-btn am-btn-sm" onclick="exitApp();"><span class="am-icon-close"></span> 退 出</button>
    </div>
  </div>
</header>

<div class="get">
  <div class="am-g">
    <div class="am-u-lg-12">
      <h1 class="get-title">DENSO 作业要领书</h1>
      <!--
      <p>
        期待你的参与，共同打造一个简单易用的前端框架
      </p>
      -->
    </div>
  </div>
</div>

<div class="detail">
  <div class="am-g am-container">
    <div class="am-u-lg-12">
      <div class="am-u-lg-8 am-u-lg-offset-1">
        #if(notice)
        <div class="am-u-sm-offset-2">
          <p class="am-text-danger am-text-lg">#(notice)</p>
        </div>
        #end
        <form id="codeForm" method="post" class="am-form am-form-horizontal" action="/show">
          <div class="am-form-group am-form-group-lg">
            <label for="boxCode" class="am-form-label am-u-sm-4">TFDACC品番:</label>
            <div class="am-u-sm-8">
              <input type="text" name="boxCode" id="boxCode" class="am-form-field" autofocus="autofocus" autocomplete="off">
            </div>
          </div>
          <div class="am-form-group am-form-group-lg">
            <label for="partCode" class="am-form-label am-u-sm-4">供应商品番:</label>
            <div class="am-u-sm-8">
              <input type="text" name="partCode" id="partCode" class="am-form-field" autocomplete="off">
            </div>
          </div>
        </form>
        <hr>
      </div>
    </div>
  </div>
</div>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="assets/js/amazeui.min.js"></script>

<script type="text/javascript">
  var flag = 0;

  document.addEventListener('keydown', function (evt) {
    switch (evt.which) {
      case 13:  // Enter
        var boxCode = $("#boxCode").val();
        var partCode = $("#partCode").val();

        if(flag == 0) {
          console.log("boxCode=" + boxCode);
          console.log("codeBegin=" + #(getInt('codeBegin')));
          console.log("codeEnd=" + #(getInt('codeEnd')));
          console.log("subCode=" + boxCode.substring(#(getInt('codeBegin')), #(getInt('codeEnd'))));

          $("#boxCode").val(boxCode.substring(#(getInt('codeBegin')), #(getInt('codeEnd'))));
          $("#partCode").focus();
          flag++;

          return;
        }

        setTimeout("submitForm()", 500);
    };
  });

  function submitForm() {
    //alert("扫码成功");
    $("#codeForm").submit();
  }

  function exitApp(){
    if (confirm("确定要退出应用吗？")){
      // exit chrome
      //window.location.href="about:blank";
      //window.close();
      window.location.href="/logout";
    }
  }
</script>
</body>
</html>
